import request from "@/utils/request"

export interface Role {
  createTime: number
  id: number
  roleName: string
  /** 角色描述 */
  commend: string
  /** 菜单数据 */
  menus: OriginMenu[];
}

export interface QueryRoleListParams extends PaginationParams {
  roleName?: string;
}

export async function queryRoleList(params: PaginationParams) {
  return request<Role[]>('/app/manager/role/list', {
    data: params,
  })
}

export async function editRole(params: Role) {
  return request('/app/manager/role/addOrUp', {
    data: params,
  })
}

export async function getRoleInfo(params: {roleId: string}) {
  return request<Role>('/app/manager/role/detail', {
    data: params,
  })
}

export async function delRole(params: {roleId: number}) {
  return request('/app/manager/role/del', {
    data: params,
  })
}
